<!doctype html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>{$Think.lang.set_user}</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="INDEX/css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="INDEX/css/main.css"/>
		<link rel="stylesheet" type="text/css" href="INDEX/css/my_msg_detail.css"/>
	</head>

	<body>
		
		<script src="INDEX/js/mui.min.js"></script>
		<!-- <script src="INDEX/js/jquery-1.8.0.min.js" type="text/javascript" charset="utf-8"></script>		 -->
		<script>
			mui.init();
		</script>
		<header class="mui-bar mui-bar-nav">
			<a href="#offCanvasSide" class="right_top"></a>
			<!--<a class="mui-switch "></a>-->
			<div class="mui-switch mui-pull-right  {if $think_var=='zh-cn'}mui-active{/if}" id="mySwitch">
  				<div class="mui-switch-handle"></div>
			</div>
			<h1 class="mui-title">{$Think.lang.project_title}</h1>
		</header>
		<div id="offCanvasWrapper" class="mui-off-canvas-wrap mui-draggable mui-slide-in">
			<div id="header">{include file='header'/}</div>
			<div class="mui-inner-wrap">
				<div id="offCanvasContentScroll" class="mui-content mui-scroll-wrapper mui-slide-in">
					<div class="mui-scroll">
						<div class="change_user_msg">
							<div class="change_user_msg_top">
								<div style="width: 86%;display: inline-block;"></div>
								<a href="javascript:history.back(-1)"> <span class="close_page" id="close_page" onclick="close()">{$Think.lang.set_close}</span></a>
							</div>
							<div class="change_user_msg_middle">
								<div class="middle_top">
									<div class="user_name_msg">
										<span>{$Think.lang.set_user_name}:</span>
										<input type="text" placeholder="{$Think.lang.set_user_input}" value="{$res['user_name']}" id="user_name"/>
									</div>
									<div class="user_phone">
										<span>{$Think.lang.set_phone}:</span>
										<input type="text" placeholder="{$Think.lang.set_phone_input}" required="required" value="{$res['user_tel']}" id="user_tel"/>
										<span class="require_need"></span>
									</div>
									<div class="intro_person">
										<span>{$Think.lang.referrer}:</span>
										<input type="text" value="{$res['puser_name']}" value="{$res['pid']}"/>
									</div>
								</div>
								<div class="middle_bottom">
									<div class="user_id">
										<span>{$Think.lang.set_IDcard}:</span>
										<input type="text" placeholder="{$Think.lang.set_IDcard_input}" required="required" value="{$res['user_card']}" id="user_card"/>
										<span class="require_need"></span>
									</div>
									<!-- <div class="user_card_place">
										<span>{$Think.lang.set_bank_add}:</span>
										<input type="text" placeholder="{$Think.lang.set_bank_add_input}"/>
										<span class="clear_all"></span>
									</div> -->
									<div class="user_card_name">
										<span>{$Think.lang.set_bank_user}:</span>
										<input type="text" placeholder="{$Think.lang.set_bank_user_input}" value="{$res['bank_user']}" id="bank_user"/>
									</div>
									<div class="user_card_num">
										<span>{$Think.lang.set_bank_id}:</span>
										<input type="number" placeholder="{$Think.lang.set_bank_id_input}" required="required" value="{$res['bank_num']}" id="bank_num"/>
										<span class="require_need"></span>
									</div>
								</div>
							</div>
							<input type="hidden" value="{$res['user_id']}" id="user_id"> 
							<div class="submit_msg">{$Think.lang.set_submit}</div>
						</div>
					</div>
				</div>
			</div>	
		</div>
		<script src="INDEX/js/switchover.js"></script>
		<script src="INDEX/js/jquery-1.8.0.min.js" type="text/javascript" charset="utf-8"></script>
		<script>
			function close(){
				// 点击返回上一页
				$("#close_page").click(function(){
					alert("返回");
					window.history.back(-1); 
				})
			}

			// 提交
			// $(".submit_msg").click(function(){
				var submit_msg = document.getElementsByClassName("submit_msg")[0];
				submit_msg.addEventListener("tap", function () {
				var user_name = $("#user_name").val();
				var user_tel = $("#user_tel").val();
				var user_card = $("#user_card").val();
				var bank_user = $("#bank_user").val();
				var bank_num = $("#bank_num").val();
				var user_id = $("#user_id").val();
				// 判断姓名是否为空
				if(user_name == "")
				{
					mui.toast("{$Think.lang.set_empty_username}")
					return false;
				}
				var phoneReg = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/;
				//电话
				var phone = $.trim(user_tel);
				if (!phoneReg.test(phone)) {
					mui.toast("{$Think.lang.set_phone_false}")
					return false;
				}
				// 判断手机号是够为空
				if(user_tel == "")
				{
					mui.toast("{$Think.lang.set_empty_phone}")
					return false;
				}		
				// 判断身份证
				// 身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X
				var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
				if(reg.test(user_card) === false)
				{
					mui.toast("{$Think.lang.set_user_card_false}")
					return  false;
				}

				$.post("{:Url('Users/set_user')}", {
                "user_name" : user_name,
                "user_tel" : user_tel,
				'user_card' : user_card,
				'bank_user' : bank_user,
				'bank_num'  : bank_num,
				'user_id'  :  user_id
            }, function(data) {
                if (data['code'] > 0) {
                    //$(".sub_login").attr("disabled", "disabled");
					mui.toast(data["message"])
                } else {
                    mui.toast(data["message"])
                }
            });

				
			})
		</script>
	</body>

</html>